package com.klun.concDesign;

import java.util.HashMap;
import java.util.Map;

public class HashMapMutiThread {

    static Map<String,String> map = new HashMap<>();

    public static class AddThread implements Runnable {

        int start = 0 ;

        public AddThread(int start) {
            this.start = start;
        }

        @Override
        public void run() {
            for (int i = 0; i < 100000; i+=2) {
                map.put(Integer.toString(i),Integer.toBinaryString(i));
            }
        }
    }

    public static void main(String[] args) throws InterruptedException {
        Thread t0 = new Thread(new AddThread(0));
        Thread t1 = new Thread(new AddThread(1));
        t0.start();
        t1.start();
        t0.join();t1.join();
        System.out.println(map.size());
    }
}
